# Run in phpMyAdmin or Whatever You're Using to Reach your Database Panel:
CREATE TABLE `tickets_emails` (`id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `ticket_id` INT UNSIGNED NOT NULL, `message_id` VARCHAR(500) NOT NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB;
ALTER TABLE `tickets` CHANGE `department_id` `department_id` TINYINT(3) UNSIGNED NULL;
INSERT INTO `settings` (`id`, `access_key`, `value`) VALUES (NULL, 'imap_host', ''), (NULL, 'imap_username', ''), (NULL, 'imap_password', ''), (NULL, 'enable_email_to_ticket', '0');
ALTER TABLE `tickets` ADD `source` TINYINT UNSIGNED NOT NULL DEFAULT '1' AFTER `status`;
INSERT INTO `settings` (`id`, `access_key`, `value`) VALUES (NULL, 'tickets_default_department_id', '1');
INSERT INTO `settings` (`id`, `access_key`, `value`) VALUES (NULL, 'tickets_default_priority', 'medium');
INSERT INTO `email_templates` (`id`, `title`, `subject`, `hook`, `language`, `template`, `is_built_in`, `updated_at`, `created_at`) VALUES (NULL, 'Ticket Confirmation', 'We\'ve Received Your Email! Ticket #{TICKET_ID}', 'ticket_confirmation', 'english', '<p>Dear Customer,<br><br>Greetings! This is an automatic email to inform you that your message has been successfully received. Your unique ticket reference number is {TICKET_ID}.<br><br>Should you have any additional information or updates you\'d like to share before our reply, please don\'t hesitate to respond to this email.<br><br>Thanks,<br>{SITE_NAME} Support</p>', '1', NULL, '1704453006');
INSERT INTO `settings` (`id`, `access_key`, `value`) VALUES (NULL, 'imap_port', '993'), (NULL, 'imap_encryption', 'ssl'), (NULL, 'imap_validate_cert', '1'), (NULL, 'imap_protocol', 'imap');
INSERT INTO `email_templates` (`id`, `title`, `subject`, `hook`, `language`, `template`, `is_built_in`, `updated_at`, `created_at`) VALUES (NULL, 'Ticket Closed', 'Action Required: Create a New Ticket for Further Assistance', 'ticket_closed', 'english', '<p>Dear Customer,<br><br>We wanted to update you on the recent ticket (#{TICKET_ID}) you attempted to reply to—it has now been officially closed in our system. We understand that this may have caused some inconvenience, and for that, we sincerely apologize.<br><br>If your initial inquiry has been successfully addressed to your satisfaction, we are delighted to have provided assistance. Nevertheless, should you have any outstanding questions, concerns, or new inquiries, we recommend initiating a new ticket dedicated to each specific matter.<br><br>We appreciate your understanding and cooperation in this matter.<br><br>Thanks,<br>{SITE_NAME} Support</p>', '1', NULL, '1704881794');
CREATE TABLE `tickets_replies_quotes` (`id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `ticket_reply_id` INT UNSIGNED NOT NULL, `message` TEXT NOT NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB;